package com.xiaotu.spider.baidu.pipeline;

import com.xiaotu.common.model.TVBaikeWorksInfoModel;
import com.xiaotu.common.model.TVStringModel;
import com.xiaotu.common.util.Constants;
import com.xiaotu.common.util.DataRedisKeyUtils;
import com.xiaotu.common.util.UUIDUtils;
import com.xiaotu.spider.APipeline;
import org.springframework.stereotype.Component;
import sun.plugin.util.UIUtil;
import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;

@Component("TVBaikeWorksInfoPipeline")
public class TVBaikeWorksInfoPipeline extends APipeline
{
    @Override
    protected void doProcess(ResultItems resultItems, Task task)
    {

        TVBaikeWorksInfoModel model = resultItems.get(TVBaikeWorksInfoModel.class.getName());
        if (model == null)
            return;

        String key = DataRedisKeyUtils.getKey(Constants.DataRedisKey.TV_BAIKE_WORKS_INFO_YYYYMMDD);
        cacheHandler.hSet(key, model.getTvname()+"_"+ UUIDUtils.getId(), model);
    }

}
